数据结构英文习题解析

您所在的位置:网站首页 random position翻译 数据结构英文习题解析

数据结构英文习题解析

2024-07-16 20:03:56| 来源: 网络整理| 查看: 265

前言:最近快到FDS考试了,po重刷了一下学校的题目,自己整理了一些解析orz 因为po在自己找解析和学习的过程中非常痛苦,所以在此共享一下我的题目和自己写的解题思路,欢迎各位指出错误~全章节预计会陆续更新,可在专栏查看~

HW2

1. For a sequentially stored linear list of length N, the time complexities for deleting the first element and inserting the last element are O(1) and O(N), respectively.

F 顺序表查找数据很快,时间复杂度为O(1),但是插入的话需要把后续元素都往后移动,时间复杂度为O(N)。链表刚好相反。

2. If a linear list is represented by a linked list, the addresses of the elements in the memory must be consecutive.

F 如果线性表用链式结构来存储,那元素地址必须连续存放。(错误,链表的结点每个都会存下一个结点地址,所以链表不需要连续存放)

3. To delete p from a doubly linked list, we must do:

A.p->prior=p->prior->prior; p->prior->next=p;

B.p->next->prior=p; p->next=p->next->next;

C.p->prior->next=p->next; p->next->prior=p->prior;

D.p->next=p->prior->prior; p->prior=p->next->next;

C 画图可知,p前一个结点的next要指向p后一个结点;p后一个结点的prior要指向p前一个结点。

4. If the most commonly used operations are to visit a random position and to insert and delete the last element in a linear list, then which of the following data structures is the most efficient?

A.doubly linked list

B.singly linked circular list

C.doubly linked circular list with a dummy head node

D.sequential list

D 因为插入删除元素只需要在尾部做,所以其实不会发生顺序存储时,插入新元素导致后续元素都要往后挪位置的情况。这样用顺序存储做插入删除和读取元素的时间复杂度都是O(1),所以省时间。

5.To merge two singly linked ascending lists, both with N nodes, into one singly linked ascending list, the minimum possible number of comparisons is:

A.1

B.N

C.2N

D.NlogN

B 要把两个有序单链表合并为一个链表,最少的比较情况可以假设一个链表中的元素是1,2,3,4,5;另一个链表是6,7,8,9,10;此时只要把6一直和1~5比5次就行,等前一个链表空了,再把后一个链表中的值直接链到新链表。所以最少比较N次。



【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭